package com.shine.app.bean;

import com.google.gson.annotations.SerializedName;
import com.shine.app.commons.StringUtils;

public class AddressBean extends BaseBean {

	private static final long serialVersionUID = 1L;
	@SerializedName("Address1")
	private String address1;
	@SerializedName("Address2")
	private String address2;
	@SerializedName("City")
	private String city;
	@SerializedName("StateCode")
	private String stateCode;
	@SerializedName("ZipCode")
	private String zipCode;

	public String getAddress1() {
		if (StringUtils.isEmpty(address1)) {
			address1 = "";
		}
		return address1;
	}

	public void setAddress1(String address1) {
		this.address1 = address1;
	}

	public String getAddress2() {
		if (StringUtils.isEmpty(address2)) {
			address2 = "";
		}
		return address2;
	}

	public void setAddress2(String address2) {
		this.address2 = address2;
	}

	public String getCity() {
		if (StringUtils.isEmpty(city)) {
			city = "";
		}
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getStateCode() {
		if (StringUtils.isEmpty(stateCode)) {
			stateCode = "";
		}
		return stateCode;
	}

	public void setStateCode(String stateCode) {
		this.stateCode = stateCode;
	}

	public String getZipCode() {
		if (StringUtils.isEmpty(zipCode)) {
			zipCode = "";
		}
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public static String getCityAddress(AddressBean address) {
		StringBuilder builder = new StringBuilder();
		String city = address.getCity().trim();
		if (StringUtils.isEmpty(city)) {
			builder.append(city + " ");
		} else {
			builder.append(city + ", ");
		}
		builder.append(address.getStateCode() + " " + address.getZipCode());
		return builder.toString().trim();
	}
}
